<template>
	<view class="pilicy-item" @click="handleToFinish(info)">
		<view class="title-tools" v-if="showName">
			<title-tools :title="info.fq_name_text" fontSize="30rpx"></title-tools>
		</view>
		<view class="title">
			{{info.title}}
		</view>
		<view class="info">
			<view class="time-group">
				<view class="start-time">
					接收时间：{{info.createtime | formatDate}}
				</view>
				<view class="end-time" v-if="info.solvetime">
					完结时间：{{info.solvetime | formatDate}}
				</view>
				<!-- <view class="end-time">
					超时时间：{{info. | formatDate}}
				</view> -->
			</view>
			<view class="btn" v-if="info.is_solve == '1' && level == '1' && info.is_db == 2 && !type">
				待办
			</view>
			<view class="btn" v-if="info.is_solve == '3' && level == '2' && info.is_db == 2 && !type">
				待办
			</view>
			<!-- 驳回列表显示 -->
			<view class="btn" v-if="(info.is_solve == '1' || (info.is_solve == '2' && info.sh_status == 3)) && level == '2' && info.is_db == 2">
				待审核
			</view>
			<!-- <view class="btn" v-if="info.is_solve == '2' && level == '1' && info.is_appeal == '2' && info.is_db == 3">
				发布公示
			</view> -->
			<view class="btn" v-if="info.is_solve == '2' && level == '1' && info.is_appeal == '2' && info.is_db == 3">
				发布公示
			</view>
			<!-- <view v-if="info.is_solve == '3'" class="dispose" @click="handleToFinish(info)">
				处理中
			</view> -->
			<view  class="have-feedback" v-if="(info.is_solve == '2' || info.is_solve == '3') && level == '2' && info.is_appeal == '2' && info.is_db == 3 && info.sh_status == 1">
				审核中
			</view>
			<view  class="have-feedback" v-else-if="(info.is_solve == '2' || info.is_solve == '3') && level == '2' && info.is_appeal == '2' && info.is_db == 3 && info.sh_status == 2 && roleName == '审核'">
				已通过
			</view>
			<view  class="overtime" v-else-if="(info.is_solve == '2' || info.is_solve == '3') && level == '2' && info.is_appeal == '2' && info.sh_status == 3">
				已驳回
			</view>
			<view  class="have-feedback" v-else-if="(info.is_solve == '2' || info.is_solve == '3') && level == '2' && info.is_appeal == '2' && info.is_db == 3">
				已反馈
			</view>
			<view class="have-assign" v-if="!type && info.is_db == 1 && info.is_solve == 3 && !info.timeout">
				已交办
			</view>
			<view class="btn" v-if="level == '5' && info.is_comment == 2">
				评论
			</view>
			<!-- 已评论 -->
			<view class="have-assign" v-if="level == 5 && info.is_comment == 1">
				已评论
			</view>
			<view class="overtime" v-if="info.timeout">
				{{info.timeout}}
			</view>
			<view class="finish" v-if="info.is_solve === '2' && info.is_appeal === '1' && level != 5">
				已公示
			</view>
		</view>
		<!-- 超时显示 -->
		<view class="urge-wrap" v-if="info.timeout && type">
			<view class="wrap">
				<!-- <view class="dot" v-if="info.is_urge == 2 || info.is_urge_organization == 2 && info.is_db == 1 && info.is_solve == 3"></view>
				<view class="text" v-if="info.is_urge == 2 || info.is_urge_organization == 2 && info.is_db == 1 && info.is_solve == 3">
					已申请催办
				</view> -->
				<view class="dot red" v-if="info.is_urge == 2 || info.is_urge_organization == 2"></view>
				<view class="text" v-if="info.is_urge == 2 || info.is_urge_organization == 2">
					已收到催办请求
				</view>
			</view>
			<view class="urge-btn" :class="info.is_urge_organization == 2 ? 'active' : ''" v-if="info.is_jb == 1">
				{{info.is_urge_organization == 2 ? '已催办' : '催办'}}
			</view>
			<!-- :class="info.is_urge == 2 && info.is_db == 1 && info.chulizhong == 1 ? 'active' : ''" -->
			<view class="urge-btn" v-if=" info.is_jb == 2 && info.timeout">
				立即处理
			</view>
		</view>
	</view>
</template>

<script>
	import TitleTools from '../../title-tools/TitleTools.vue'
	export default {
		name: 'PilicyItem',
		components: { TitleTools },
		props: {
			info: {
				type: Object,
				default() {
					return {}
				}
			},
			showName: {
				type: Boolean,
				default: false
			},
			//是否超时
			type: {
				type: Boolean,
				default: false
			}
		},
		created() {
			console.log(this.type)
		},
		data() {
			return {
				level: getApp().globalData.level,
				roleName: getApp().globalData.roleName
			}
		},
		methods: {
			//跳转已办事项详情页
			handleToFinish (info) {
				// if (info.is_urge_organization == 2) return
				this.$emit('click', info)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pilicy-item {
		padding-bottom: 30rpx;
		// margin-bottom: 30rpx;
		.title {
			font-size: 30rpx; 
			font-weight: 500;
			color: #000000;
			overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
		}
		
		.info {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 29rpx;
			.time-group {
				font-size: 24rpx;
				color: #929292;
			}
			.btn {
				font-size: 28rpx;
				color: #FFFFFF;
				width: 180rpx;
				height: 50rpx;
				line-height: 50rpx;
				text-align: center;
				background: #196EFF;
				border-radius: 25rpx;
			}
		}
		&:nth-last-child(2){
			border: none;
			margin-bottom: 0;
			// padding-bottom: 0;
		}
	}
	
	.title-tools {
		margin-bottom: 30rpx;
	}
	
	.finish {
		font-size: 28rpx;
		color: #13E139;
	}
	
	.dispose {
		font-size: 28rpx;
		color: #196EFF;
	}
	
	.overtime {
		font-size: 28rpx;
		color: #FF0000;
	}
	
	.have-feedback {
		font-size: 28rpx;
		color: #13E139;
	}
	
	.have-assign {
		font-size: 28rpx;
		color: #196EFF;
	}
	
	.urge-wrap {
		display: flex;
		justify-content: space-between;
		margin-top: 30rpx;
		.wrap {
			display: flex;
			align-items: center;
			justify-content: center;
			.dot {
				width: 10rpx;
				height: 10rpx;
				background: #196EFF;
				border-radius: 50%;
				&.red {
					background-color: #FF0000;
				}
			}
			.text {
				margin-left: 8rpx;
				font-size: 28rpx;
				color: #929292;
			}
		}
		.urge-btn {
			width: 180rpx;
			height: 50rpx;
			line-height: 50rpx;
			text-align: center;
			color: #fff;
			background: #196EFF;
			border-radius: 25rpx;
			&.active {
				background: #929292;
			}
		}
	}
</style>
